/*
 * Copyright (c) Hisilicon Technologies Co., Ltd. 2023-2023. All rights reserved.
 * Description: IMX219 Register Configure file
 * Author: Hisilicon multimedia software group
 * Create: 2023-03-06
 */
#ifndef IMX219_CFGS_H
#define IMX219_CFGS_H
#include "hi_sns_ctrl.h"

typedef struct cis_cfg {
    hi_u16 address;
    hi_u8 value;
} cis_cfg_imx219_t;

/* 3280*2464 20fps raw 10 2Lane ok */
const cis_cfg_imx219_t imx219_raw10_24M_20fps_mipi2lane[] = {
    {0x0100, 0x00},
    {0x30EB, 0x05},
    {0x30EB, 0x0C},
    {0x300A, 0xFF},
    {0x300B, 0xFF},
    {0x30EB, 0x05},
    {0x30EB, 0x09},
    {0x0114, 0x01},  // 2lane 0x01; 4lane 0x04
    {0x0128, 0x00},  // MIPI Global timing setting, 0: auto mode, 1: manual mode
    {0x012A, 0x18},
    {0x012B, 0x00},  // INCK frequency
    {0x015A, 0x03},
    {0x0160, 0x0A},
    {0x0161, 0x55},  // FRM_LENGTH
    {0x0162, 0x0D},
    {0x0163, 0x78},  // LINE_LENGTH
    {0x0164, 0x00},
    {0x0165, 0x00},  // X_ADD_STA_A
    {0x0166, 0x0C},
    {0x0167, 0xd0},
    {0x0168, 0x00},
    {0x0169, 0x00},
    {0x016A, 0x09},
    {0x016B, 0xa0},
    {0x016C, 0x0C},
    {0x016D, 0xD0}, // output image size (X-direction)
    {0x016E, 0x09},
    {0x016F, 0xA0}, // output image size (Y-direction)
    {0x0170, 0x01},
    {0x0171, 0x01},
    {0x0174, 0x00},
    {0x0175, 0x00},
    {0x018C, 0x0A},  // CSI_DATA_FORMAT_A
    {0x018D, 0x0A},  // CSI_DATA_FORMAT_A
    {0x0301, 0x05},
    {0x0303, 0x01},
    {0x0304, 0x03},
    {0x0305, 0x03},
    {0x0306, 0x00},
    {0x0307, 0x39},
    {0x0309, 0x0A},
    {0x030B, 0x01},
    {0x030C, 0x00},
    {0x030D, 0x72},
    {0x455E, 0x00},
    {0x471E, 0x4B},
    {0x4767, 0x0F},
    {0x4750, 0x14},
    {0x4540, 0x00},
    {0x47B4, 0x14},
    {0x4713, 0x30},
    {0x478B, 0x10},
    {0x478F, 0x10},
    {0x4793, 0x10},
    {0x4797, 0x0E},
    {0x479B, 0x0E},
    {0x0100, 0x01},
};

/* 3280*2464 20fps raw8 2Lane ok */
const cis_cfg_imx219_t imx219_raw8_24M_20fps_mipi2lane[] = {
    {0x0100, 0x00},
    {0x30EB, 0x05},
    {0x30EB, 0x0C},
    {0x300A, 0xFF},
    {0x300B, 0xFF},
    {0x30EB, 0x05},
    {0x30EB, 0x09},
    {0x0114, 0x01},  // 2lane 0x01; 4lane 0x04
    {0x0128, 0x00},  // MIPI Global timing setting, 0: auto mode, 1: manual mode
    {0x012A, 0x18},
    {0x012B, 0x00},  // INCK frequency
    {0x015A, 0x03},
    {0x0160, 0x0A},
    {0x0161, 0x55},  // FRM_LENGTH
    {0x0162, 0x0D},
    {0x0163, 0x78},  // LINE_LENGTH
    {0x0164, 0x00},
    {0x0165, 0x00},  // X_ADD_STA_A
    {0x0166, 0x0C},
    {0x0167, 0xd0},
    {0x0168, 0x00},
    {0x0169, 0x00},
    {0x016A, 0x09},
    {0x016B, 0xa0},
    {0x016C, 0x0C},
    {0x016D, 0xD0},
    {0x016E, 0x09},
    {0x016F, 0xA0},
    {0x0170, 0x01},
    {0x0171, 0x01},
    {0x0174, 0x00},
    {0x0175, 0x00},
    {0x018C, 0x08},  // CSI_DATA_FORMAT_A
    {0x018D, 0x08},  // CSI_DATA_FORMAT_A
    {0x0301, 0x05},
    {0x0303, 0x01},
    {0x0304, 0x03},
    {0x0305, 0x03},
    {0x0306, 0x00},
    {0x0307, 0x39},
    {0x0309, 0x08},  // OPPXCK_DIV
    {0x030B, 0x01},
    {0x030C, 0x00},
    {0x030D, 0x72},
    {0x455E, 0x00},
    {0x471E, 0x4B},
    {0x4767, 0x0F},
    {0x4750, 0x14},
    {0x4540, 0x00},
    {0x47B4, 0x14},
    {0x4713, 0x30},
    {0x478B, 0x10},
    {0x478F, 0x10},
    {0x4793, 0x10},
    {0x4797, 0x0E},
    {0x479B, 0x0E},
    {0x0100, 0x01},
};

static const cis_cfg_imx219_t imx219_raw10_1920x1080_30fps_mipi2lane[] = {
    {0x0100, 0x00},
    {0x30EB, 0x05},
    {0x30EB, 0x0C},
    {0x300A, 0xFF},
    {0x300B, 0xFF},
    {0x30EB, 0x05},
    {0x30EB, 0x09},
    {0x0114, 0x01},  // 2lane 0x01; 4lane 0x04
    {0x0128, 0x00},  // MIPI Global timing setting, 0: auto mode, 1: manual mode
    {0x012A, 0x18},
    {0x012B, 0x00},  // INCK frequency
    {0x015A, 0x02}, // coarse_integration_time
    {0x0160, 0x0A},
    {0x0161, 0x55},  // FRM_LENGTH
    {0x0162, 0x0D},
    {0x0163, 0x78},  // LINE_LENGTH
    {0x0164, 0x00},
    {0x0165, 0x00},  // X_ADD_STA_A
    {0x0166, 0x07},
    {0x0167, 0x80},
    {0x0168, 0x00},
    {0x0169, 0x00},
    {0x016A, 0x04},
    {0x016B, 0x38},
    {0x016C, 0x07},
    {0x016D, 0x80},
    {0x016E, 0x04},
    {0x016F, 0x38},
    {0x0170, 0x01},
    {0x0171, 0x01},
    {0x0174, 0x00},
    {0x0175, 0x00},
    {0x018C, 0x0A},  // CSI_DATA_FORMAT_A
    {0x018D, 0x0A},  // CSI_DATA_FORMAT_A
    {0x0301, 0x05},
    {0x0303, 0x01},
    {0x0304, 0x03},
    {0x0305, 0x03},
    {0x0306, 0x00},
    {0x0307, 0x39},
    {0x0309, 0x0A},
    {0x030B, 0x01},
    {0x030C, 0x00},
    {0x030D, 0x72},
    {0x0600, 0x00},
    {0x0601, 0x00},
    {0x0624, 0x07},
    {0x0625, 0x80},
    {0x0626, 0x04},
    {0x0627, 0x38},
    {0x455E, 0x00},
    {0x471E, 0x4B},
    {0x4767, 0x0F},
    {0x4750, 0x14},
    {0x4540, 0x00},
    {0x47B4, 0x14},
    {0x4713, 0x30},
    {0x478B, 0x10},
    {0x478F, 0x10},
    {0x4793, 0x10},
    {0x4797, 0x0E},
    {0x479B, 0x0E},
    {0x0100, 0x01},
};

#endif // IMX219_CFGS_H